package com.missilike.admin.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.missilike.biz.IMilContentStatisticService;
import com.missilike.core.result.CommonResult;
import com.missilike.core.utils.ResultUtils;
import com.missilike.domain.response.MilContentStatisticInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 统计表 前端控制器
 * </p>
 *
 * @author kin
 * @since 2019-02-19
 */
@RestController
@RequestMapping("api/mil/statistic")
public class MilContentStatisticController {

    private final IMilContentStatisticService milContentStatisticService;

    @Autowired
    public MilContentStatisticController(IMilContentStatisticService milContentStatisticService) {
        this.milContentStatisticService = milContentStatisticService;
    }

    @RequestMapping(value = "page", method = RequestMethod.GET)
    public CommonResult list(@RequestParam(value = "pageNum", required = false, defaultValue = "1") int pageNum,
                             @RequestParam(value = "pageSize", required = false, defaultValue = "20") int pageSize,
                             @RequestParam(value = "title", required = false, defaultValue = "") String title,
                             @RequestParam(value = "statDate", required = false, defaultValue = "") String statDate) {
        IPage<MilContentStatisticInfo> statisticInfoIPage = milContentStatisticService.getList(new Page<>(pageNum, pageSize), title, statDate);
        return ResultUtils.ok(statisticInfoIPage);
    }
}

